

<%@ page import="auctionatr.Auction" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'auction.label', default: 'Auction')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${auctionInstance}">
            <div class="errors">
                <g:renderErrors bean="${auctionInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${auctionInstance?.id}" />
                <g:hiddenField name="version" value="${auctionInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="name"><g:message code="auction.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" maxlength="40" value="${auctionInstance?.name}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="description"><g:message code="auction.description.label" default="Description" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'description', 'errors')}">
                                    <g:textField name="description" value="${auctionInstance?.description}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="finishDate"><g:message code="auction.finishDate.label" default="Finish Date" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'finishDate', 'errors')}">
                                    <g:datePicker name="finishDate" precision="day" value="${auctionInstance?.finishDate}"  />
                                </td>
                            </tr>
                        
                         
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="startPrice"><g:message code="auction.startPrice.label" default="Start Price" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'startPrice', 'errors')}">
                                    <g:textField name="startPrice" value="${fieldValue(bean: auctionInstance, field: 'startPrice')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="state"><g:message code="auction.state.label" default="State" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'state', 'errors')}">
                                    <g:select name="state" from="${auctionInstance.constraints.state.inList}" value="${auctionInstance?.state}" valueMessagePrefix="auction.state"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="shipment"><g:message code="auction.shipment.label" default="Shipment" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'shipment', 'errors')}">
                                    <g:select name="shipment" from="${auctionInstance.constraints.shipment.inList}" value="${auctionInstance?.shipment}" valueMessagePrefix="auction.shipment"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="category"><g:message code="auction.category.label" default="Category" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'category', 'errors')}">
                                    <g:select name="category" from="${auctionInstance.constraints.category.inList}" value="${auctionInstance?.category}" valueMessagePrefix="auction.category"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="dateCreated"><g:message code="auction.dateCreated.label" default="Start Date" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'dateCreated', 'errors')}">
                                    <g:datePicker name="dateCreated" precision="day" value="${auctionInstance?.dateCreated}" default="none" noSelection="['': '']" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="deliveryCosts"><g:message code="auction.deliveryCosts.label" default="Delivery Costs" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'deliveryCosts', 'errors')}">
                                    <g:textField name="deliveryCosts" value="${fieldValue(bean: auctionInstance, field: 'deliveryCosts')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="bids"><g:message code="auction.bids.label" default="Bids" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: auctionInstance, field: 'bids', 'errors')}">
                                    
<ul>
<g:each in="${auctionInstance?.bids?}" var="b">
    <li><g:link controller="bid" action="show" id="${b.id}">${b?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="bid" action="create" params="['auction.id': auctionInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'bid.label', default: 'Bid')])}</g:link>

                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
